<template>
  <div>
    <el-card class="box-card">
      <div class="BigDiv">
        <span>操作人名称：</span>
        <el-input class="ElInput" v-model="operateUser"></el-input>
        <span>操作类型：</span>
        <el-select v-model="operateDetails">
          <el-option label="全部" value=""></el-option>
          <el-option label="添加" value="添加"></el-option>
          <el-option label="修改" value="修改"></el-option>
          <el-option label="删除" value="删除"></el-option>
        </el-select>
        <el-button icon="el-icon-search" type="primary" @click="list"></el-button>
        <!--表格-->
        <el-table
            :data="tableData"
            height="730"
            border
            style="margin-top: 10px;width: 100%">
          <el-table-column
              prop="operateUser"
              label="操作人"
              width="180">
          </el-table-column>
          <el-table-column
              prop="operateModules"
              label="操作模块"
              width="180">
          </el-table-column>
          <el-table-column
              prop="operateDetails"
              label="操作内容">
          </el-table-column>
          <el-table-column
              prop="createTime"
              label="操作日期">
          </el-table-column>
        </el-table>
        <!--表格-->
      </div>
    </el-card>
    <!--分页-->
    <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :page-sizes="[10, 20, 30, 40]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
    </el-pagination>
    <!--分页-->
  </div>
</template>

<script>
export default {
  /*Data*/
  data() {
    return {
      pageSize: 10,
      pageNum: 1,
      total: 0,
      operateUser: '',
      operateDetails: ''
    }
  },
  /*自动挂载*/
  mounted() {
    this.list()
  },
  /*函数*/
  methods: {
    /*全查*/
    list() {
      this.$axios.get('memberZjx/detailsLogs/list', {
        params: {
          operateDetails: this.operateDetails,
          operateUser: this.operateUser,
          pageNum: this.pageNum,
          pageSize: this.pageSize
        }
      }).then(res => {
        if (res.data.code === 200) {
          this.tableData = res.data.obj.content
          this.total = res.data.obj.total
        } else {
          this.MyMessage(res.data.obj, 'info')
        }
      })
    },
    /*删除窗口*/
    openRemoveWindow(id) {
      this.$confirm('此操作将永久删除, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.remove(id)
      }).catch(() => {
        this.MyMessage('取消删除', 'info')
      });
    },
    /*函数*/
    methods: {
      /*删除*/
      remove(id) {
        this.$axios.post('memberZjx/slideshowImage/remove/' + id).then(res => {
          if (res.data.code === 200) {
            this.MyMessage('删除', 'success')
            this.list()
            this.deleteLog('轮播图管理')
          } else {
            this.MyMessage(res.data.obj, 'info')
          }
        })
      },
      MyMessage(msg, type) {
        this.$notify({
          showClose: true,
          message: msg,
          type: type
        })
      },
      handleSizeChange(val) {
        this.pageSize = val
        this.list()
      },
      handleCurrentChange(val) {
        this.pageNum = val
        this.list()
      },
      handleClose(done) {
        done()
      }
    }
  }
}
</script>

<style>
*{
  margin: 0;
  padding: 0;
}
.ElInput{
  width: 200px;
}
.box-card{
  height: 820px;
  margin: 10px;
}
</style>